Support Printing Tree for MultiIndex Columns #120
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
MultiIndex columns do not occur natively in Hatchet, however Thicket has some cases where the columns in a
Thicket.statsframe.dataframe
will become MultiIndex. This is relevant since theThicket.statsframe
is aHatchet.GraphFrame
, so to support printing theThicket.statsframe.tree()
, there must be a separate check for MultiIndex columns in Hatchet. This should not impact the functionality of Hatchet users usingGraphFrame.tree()
, since theGraphFrame.dataframe
wont be MultiIndex if only using Hatchet by itself.Current Issue
The current code
dataframe.loc[df_index, self.name]
returns a series when the columns are MultiIndex, which looks unsightly in the tree printout. We can avoid this by slightly tweaking the format to index directly to the string value.Why hasn't this been an issue before?
Thicket.tree()
prints on theThicket.statsframe.dataframe
aswell, but it handles this case appropriately by checking for the MultiIndex. So the currentThicket.tree()
function can be used to avoid this problem. However, once LLNL/thicket#118 is merged, theThicket.tree()
will print on theThicket.dataframe
instead of the statsframe. Therefore, this functionality is necessary to continue to support bothThicket.tree()
andThicket.statsframe.tree()
.